<?php

function GetCurlPage ($pageSpec){
        $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
        $ch = curl_init($pageSpec);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_TIMEOUT,      20);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,      20);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
        $tmp = curl_exec ($ch);
        curl_close ($ch);
        return $tmp;
}

$hostname = "myvm";
$ip = yfor_gethostbyname($hostname);


$url_challenge = "http://$ip:8888/index.html";
$cha_res = GetCurlPage($url_challenge);

echo "$ip\n";
echo $cha_res;
?>
